package com.winhxd.b2c.order.adapter;

import com.winhxd.b2c.common.domain.order.condition.OrderStartAfterSaleCondition;
import com.winhxd.b2c.common.domain.order.enums.AfterSaleTypeEnum;
import com.winhxd.b2c.order.adapter.impl.AfterSaleRefundNoSend;
import com.winhxd.b2c.order.adapter.impl.AfterSaleCancel;

/**
 * 售后处理适配器
 *
 * @author hjw
 * @create 2019-01-09 14:26
 **/
public abstract class AbstractAfterSaleAdapter {

    /**
    * @author hjw
    * @date 2019/1/9 15:59
    * @param condition
    * @Description  售后处理是否成功受理
    * @return
    */
    public abstract boolean execute(OrderStartAfterSaleCondition condition);

    public static AbstractAfterSaleAdapter getAfterSaleAdapter(AfterSaleTypeEnum afterSaleType){
        switch (afterSaleType.getTypeCode()){
            case 1:
                return new AfterSaleRefundNoSend();
            case 2:
                return new AfterSaleCancel();
            case 4:
                return new AfterSaleCancel();
            case 6:
                return new AfterSaleCancel();
            case 8:
                return new AfterSaleCancel();
            case 10:
                return new AfterSaleCancel();
            case 12:
                return new AfterSaleCancel();
            case 14:
                return new AfterSaleCancel();
            default:
                return null;
        }
    }
}
